//
//  CYZiXunTitleTableViewCell.m
//  cyydt
//
//  Created by chu on 2019/1/23.
//  Copyright © 2019 chu. All rights reserved.
//

#import "CYZiXunTitleTableViewCell.h"

@implementation CYZiXunTitleTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.headImageView.layer.cornerRadius = self.headImageView.frame.size.height / 2;
    self.headImageView.layer.masksToBounds = YES;
    self.guanzhuBtn.layer.cornerRadius = 5;
    self.guanzhuBtn.layer.masksToBounds = YES;
}

- (void)setModel:(CYProjectModel *)model{
    _model = model;
    self.titleLabel.text = model.title;
    
    [self.headImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageWithColor:[UIColor lightGrayColor] Size:self.headImageView.frame.size]];
    self.nicknameLabel.text = model.nickname;
    self.timeLabel.text = model.created_time;
    
    if ([model.is_follow integerValue] == 2) {
        //未关注
        [self.guanzhuBtn setTitle:@"+ 关注" forState:UIControlStateNormal];
        [self.guanzhuBtn setBackgroundColor:RGBOF(0xFF5353)];
        [self.guanzhuBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    }else{
        [self.guanzhuBtn setTitle:@"已关注" forState:UIControlStateNormal];
        [self.guanzhuBtn setBackgroundColor:RGBOF(0xe3e3e3)];
        [self.guanzhuBtn setTitleColor:RGBOF(0x999999) forState:UIControlStateNormal];
    }
}

- (IBAction)guanzhuAction:(UIButton *)sender {
    if (self.block) {
        self.block();
    }
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
